#import "TSSendDetailController.h"
#import "TSSendTableView.h"
#import "TSPraiseEditContentController.h"
#import "TSCreateTaskController.h"
@implementation TSSendDetailController

-(UIActionSheet *)createActionSheet
{
    WS(weakSelf);
    UIActionSheet * actionSheet;
    switch (self.detailType) {
        case SendDetail_Type_waitSend:
            actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:weakSelf cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"查看审核人",@"查看监督人",@"查看建议列表",@"确认下发",@"修改", nil];
            break;
        case SendDetail_Type_waitAudit:
             actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:weakSelf cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"查看审核人",@"查看监督人",@"查看建议列表", nil];
            break;
        case SendDetail_Type_run:
             actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:weakSelf cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"查看审核人",@"查看监督人",@"查看建议列表",@"提出建议", nil];
            break;
        default:
            break;
    }
    return actionSheet;}

#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0) {
        [self showAuditors];
    }else if(buttonIndex == 1){
      [self showSupervisers];
    }else if(buttonIndex == 2){
        [self showSuggest];
    }else{
    
    switch (self.detailType) {
        case SendDetail_Type_waitSend:
            if (buttonIndex == 3) {
                //确认下发
                [self sendTask];
            }else if(buttonIndex == 4){
                //修改
                TSCreateTaskController * create_col = [[TSCreateTaskController alloc] init];
                create_col.msgId =self.taskModel.tId;
                [self.navigationController pushViewController:create_col animated:YES];
            }
            break;
        case SendDetail_Type_waitAudit:
            break;
        case SendDetail_Type_run:
            if (buttonIndex == 3) {
                //建议
                [self makeSuggest];
            }
            break;
    }
    }
}

-(void)praise{
    TSPraiseEditContentController * edit_col = [[TSPraiseEditContentController alloc] init];
    edit_col.taskId = self.taskModel.tId;
    [self.navigationController pushViewController:edit_col animated:YES];
}

@end
